using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class JiangLi : MonoBehaviour
{
    Button button;
    public enum JiangLiType
    {
        Card,
        Health
    }

    public JiangLiType jiangLiType;

    private void Start()
    {
        button = GetComponent<Button>();

        switch (jiangLiType)
        {
            case JiangLiType.Card:
                FightCardManager.Instance.onClicked += OnDestory;
                button.onClick.AddListener(CardJiangLi);
                break;
            case JiangLiType.Health:
                button.onClick.AddListener(HealthJiangLi);
                break;
            default:
                break;
        }

    }

    private void OnDestory()
    {
        FightCardManager.Instance.onClicked -= OnDestory;
        Destroy(gameObject);
    }

    private void CardJiangLi()
    {
        UIManager.Instance.ShowUI<RewardCardUI>("RewardCardUI", "UI");
        UIManager.Instance.HideUI<SmallWinUI>("SmallWinUI");
    }

    private void HealthJiangLi()
    {
        RoleManager.Instance.character.Heal(10);
        Destroy(gameObject);
    }
}
